<template>
  <div class="container" id="input" tabindex="0">
    <input placeholder="请输入关键词" ref="object" size="30" type="text" />
  </div>
</template>
<style scoped>
.container {
  position: absolute;
  display: flex;
  top: var(--height-input-box);
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  max-width: 90%;
  height: 42px;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  box-shadow: rgba(0, 0, 0, 0.2) 0 0 10px;
  backdrop-filter: blur(10px) saturate(1.5);
  transition: 0.25s ease-in-out;
}

.container:hover,
.container:focus,
.container:active {
  background: rgba(15, 15, 15, 0.8);
  width: 530px;
}

.container.focus {
  background: rgba(15, 15, 15, 0.8);
  width: 530px;
  will-change: width;
}

.engine-container {
  left: 50%;
  transform: translate(-50%, calc(-100% - 24px));
  position: absolute;
  display: flex;
  justify-content: center;
  width: max-content;
  height: max-content;
  transition: 0.25s ease-in-out;
  pointer-events: none;
  opacity: 0;
}

.engine-container.focus {
  pointer-events: auto;
  opacity: 1;
}

.engine {
  display: flex;
  justify-content: center;
  align-items: center;
  width: max-content;
  height: max-content;
  transition: 0.25s;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  margin: 0 8px;
  cursor: pointer;
}

.engine.toggle {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.container input {
  margin: 0 auto;
  width: calc(100% - 56px);
  height: 100%;
  border: none;
  outline: 0;
  text-align: center;
  font-size: 14px;
  padding: 0 20px;
  border-radius: 30px;
  background: transparent;
  color: #fff;
  letter-spacing: 1px;
}

.result {
  position: absolute;
  width: 100%;
  top: 48px;
  display: none;
  flex-direction: column;
}

.result.focus {
  display: flex;
}

.container .search-result {
  display: flex;
  flex-direction: column;
  opacity: 0;
  padding: 18px 24px;
  transform-origin: top;
  transition: 0.55s height, 0.45s opacity;
  background: rgba(15, 15, 15, 0.2);
  backdrop-filter: blur(12px);
  pointer-events: none;
  width: 100%;
  border-radius: 16px;
  height: max-content;
  list-style: none;
}

.container .search-result.focus {
  opacity: 1;
  pointer-events: all;
}

.intelligence-result {
  display: flex;
  flex-direction: row;
  opacity: 0;
  padding: 18px 36px;
  margin-bottom: 6px;
  transition: 0.45s;
  background: rgba(15, 15, 15, 0.8);
  backdrop-filter: blur(12px);
  pointer-events: none;
  width: 100%;
  border-radius: 12px;
  height: max-content;
}

@keyframes BlinkAnimation {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.intelligence-result p.typing::after {
  content: "";
  background: #fff;
  display: inline-block;
  top: 4px;
  width: 4px;
  height: 18px;
  margin-right: 2px;
  animation: BlinkAnimation 1s infinite;
  font-family: var(--fonts-en);
}

.intelligence-result p.typing.finished::after {
  display: none;
}

.intelligence-result svg {
  fill: #fff;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transform: translateX(-12px);
}

.intelligence-result.focus {
  opacity: 1;
  pointer-events: all;
}

@media screen and (max-width: 620px) {
  .container.focus {
    top: calc(var(--height-input-box) - 20px);
  }

  .engine-container.focus {
    transform: translate(-50%, calc(-100% - 12px));
  }
}
</style>
